import { service } from '@/service'

enum Api {
  role = 'roles',
  roleSelect = 'roles/select'
}

export const roleList = (params: any) => {
  return service.request({
    url: Api.role,
    method: 'GET',
    params
  })
}

export const roleDetail = (role: any) => {
  return service.request({
    url: Api.role + `/${role}`,
    method: 'GET'
  })
}

export const roleAdd = (data: any) => {
  return service.request({
    url: Api.role,
    method: 'POST',
    data
  })
}

export const roleEdit = (role: number, data: any) => {
  return service.request({
    url: Api.role + `/${role}`,
    method: 'put',
    data
  })
}

export const roleDel = (role: any) => {
  return service.request({
    url: Api.role + `/${role}`,
    method: 'DELETE'
  })
}

export const roleSelect = () => {
  return service.request({
    url: Api.roleSelect,
    method: 'GET'
  })
}
